import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ServicePackageVO, ServicePackageForm, ServicePackageQuery } from '@/api/system/servicePackage/types';

/**
 * 查询服务套餐列表
 * @param query
 * @returns {*}
 */

export const listServicePackage = (query?: ServicePackageQuery): AxiosPromise<ServicePackageVO[]> => {
  return request({
    url: '/system/servicePackage/list',
    method: 'get',
    params: query
  });
};


export const zlServicePack = (data: ServicePackageForm) => {
  return request({
    url: '/system/servicePackage/list',
    method: 'get',
     data: data
  });
};

/**
 * 查询服务套餐详细
 * @param serviceId
 */
export const getServicePackage = (serviceId: string | number): AxiosPromise<ServicePackageVO> => {
  return request({
    url: '/system/servicePackage/' + serviceId,
    method: 'get'
  });
};

/**
 * 新增服务套餐
 * @param data
 */
export const addServicePackage = (data: ServicePackageForm) => {
  return request({
    url: '/system/servicePackage',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务套餐
 * @param data
 */
export const updateServicePackage = (data: ServicePackageForm) => {
  return request({
    url: '/system/servicePackage',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务套餐
 * @param serviceId
 */
export const delServicePackage = (serviceId: string | number | Array<string | number>) => {
  return request({
    url: '/system/servicePackage/' + serviceId,
    method: 'delete'
  });
};
